<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.hs.pre.model.*" %>
<%@ page import="com.hs.*" %>
<%@ page import="com.hs.utils.*" %>
<%@ page import="com.hs.pre.page.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
List docList = (List)request.getAttribute("resultDoc");
Map  param = (Map)request.getAttribute("params");
String  resultNum = (String)request.getAttribute("resultNum");
String  paramStr = (String)request.getAttribute("paramStr");
String  startNum = (String)request.getAttribute("start");
String  endNum = (String)request.getAttribute("endNum");
String title = Environment.getValue(Environment.PROP_APP_TITLE);
 
%>

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
      <head>  
        <title><%=title %></title>
            <LINK href="<%=path %>/app/css/search.css" type=text/css rel=stylesheet>
			<SCRIPT src="<%=path %>/app/js/search.js" type=text/javascript></SCRIPT>
			 <LINK href="<%=basePath%>/app/css/default.css" type=text/css rel=stylesheet>
			<SCRIPT src="<%=path %>/app/js/common.js" type=text/javascript></SCRIPT> 
			<script type="text/javascript">
			function doSearch(){
				if(hfm.q.value==""){
					return;
				}
				hfm.q.value="fangm:"+hfm.q.value;
				hfm.fq.value="";
				//alert("here fq is "+hfm.fq.value+" and q is "+hfm.q.value);
			   	hfm.submit();
			}
			function subSearch(){
				var ieKey=event.keyCode;
				if(ieKey!=13){//press enter
					return;
				}
				var fangm=document.getElementById("fmSubset").value;
				var yaowzc=document.getElementById("ywzcSubset").value;
				var gongx=document.getElementById("gxSubset").value;
				var zuz=document.getElementById("zzSubset").value;
				var chufly=document.getElementById("lySubset").value;
				
				var newParam ="";
				if(fangm!=""){
					fangm = fangm.replace(/ /g," AND "+"fangm:");
					if(newParam!=""){
						newParam+=" AND ";
					}
					newParam += "fangm:"+fangm;					
				}
				if("" != yaowzc){
					yaowzc = yaowzc.replace(/ /g," AND "+"yaowzc:");
					if(newParam!=""){
						newParam+=" AND ";
					}
					newParam += "yaowzc:"+yaowzc;
				}
				if("" != gongx){
					gongx = gongx.replace(/ /g," AND "+"gongx:");
					if(newParam!=""){
						newParam+=" AND ";
					}
					newParam += "gongx:"+gongx;
				}
				if("" != zuz){
					zuz = zuz.replace(/ /g," AND "+"zuz:");
					if(newParam!=""){
						newParam+=" AND ";
					}
					newParam += "zuz:"+zuz;
				}
				if("" != chufly){
					chufly = chufly.replace(/ /g," AND "+"chufly:");
					if(newParam!=""){
						newParam+=" AND ";
					}
					newParam += "chufly:"+chufly;
				}
				//alert("new param is "+newParam);
				if(newParam==""){
					return;
				}
				hfm.q.value = newParam;
				hfm.submit();
			}
			</script>
        </head>
<body>
<DIV style="CLEAR: both; VISIBILITY: hidden"></DIV>
	<FORM id="hfm" name="hfm" method="post" onsubmit="doSearch();" action="<%=path %>/app/pre/simpleSearch.do?sortId=<%=request.getParameter("sortId")%>" >
	<TABLE class="csst" style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 9px; PADDING-TOP: 9px" cellSpacing="0" cellPadding="0">
    <TBODY>
	  <TR>	
	  	<TD align="center"> 
		      <TABLE style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" cellSpacing="2" cellPadding="0">
		        <TBODY>
		        <TR>
		          <TD style="FONT-SIZE: 72%; COLOR: #a8a8a8" noWrap="true" colSpan="3">示例: 大黄 或 当归 </TD>
		        </TR>
		        <TR>
		          <TD><INPUT class="csmf" name="q" id="haq" style="WIDTH: 360px" maxLength="512" size="50" value="" />
		          	<input type="hidden" name="idsubSet" />
  					<input name="version" type="hidden" value="2.2" />
  					<input name="start" type="hidden" value="0" />
  					<input name="rows" type="hidden" value="20" /> 
  					<input name="df" type="hidden" value="fangm" />
  					<input name="fq" type="hidden" value="<%=paramStr%>" />
  					<input name="echoParams" type="hidden" value="ALL"  value=""/>
		          </TD>
		          <TD vAlign="top" noWrap="true"><INPUT class="csmf" id="has" type="button" onclick="doSearch();" value="方泉搜索"/><input name="button" type="button" class="csmf"   onclick="form01.submit();" value="加入分类"></TD>
		          <TD vAlign="top" noWrap="true"></TD>
		        </TR>
		      	</TBODY>
		     </TABLE>
	     	</TD> 
	     </TR> 
     </TBODY>
     </TABLE> 
     </FORM>

<TABLE class="sprs" cellSpacing="0" cellPadding="0">
  <TBODY>
  <TR>
    <TD>
    
    </TD>
    <TD id="prs" noWrap="true" align="right">
    	<FONT size="-1">约有<B id="ptr"><%=resultNum %></B>项搜索结果</FONT>
    </TD>
      </TR>
  </TBODY>
</TABLE>
<TABLE class="csst" cellSpacing="0" cellPadding="0">
<TBODY> 
  <TR>
    <TD vAlign="top">
      <DIV style="BACKGROUND-COLOR: #e8eef7">
      <DIV id="spsd"></DIV>
      <DIV id="spds">
      </DIV>
    </DIV>
      <TABLE class="csst sprft" cellSpacing="0" border="0" cellpading="0"> 
        <TBODY id="spar">
        <TR class="sbr csmf">
          <TD class="sbarf" style="BORDER-RIGHT: #cccccc 1px solid">
            <DIV style="OVERFLOW: hidden; WIDTH: 170px; HEIGHT: 1px"></DIV><SPAN 
            style="FONT-WEIGHT: bold">方名 <input type="checkbox" value="" id="sel_id" onclick="fullsel(form01,'sel_id','preId')" name=""></SPAN> 
            <TABLE class="sbasc sbwd" cellSpacing="0" cellPadding="0">
              <TBODY>
              <TR>
                <TD>
                <INPUT class="sbas" name="fmSubset" id="fmSubset" style="CURSOR: default" maxLength="100" value="" onkeyPress="subSearch();"/>
                </TD>
                <TD></TD>
                 </TR></TBODY>
            </TABLE>
          </TD>
          <TD class="sbarf" id="sbarf价格" style="BORDER-RIGHT: #cccccc 1px solid" name="sbarf">
            <SPAN style="FONT-WEIGHT: bold">来源</SPAN>
            <DIV>
            <TABLE class="sbasc sbwd"  cellSpacing="0" cellPadding="0"> 
              <TBODY>
              <TR>
                <TD>
                <INPUT class="sbas" name="lySubset" id="lySubset" style="CURSOR: default" maxLength="100" value=""  onkeydown="subSearch();" />
                </TD>
                </TR>
                </TBODY>
             </TABLE>
            </TD>
          <TD class="sbarf" id="sbarf地区" style="BORDER-RIGHT: #cccccc 1px solid" 
          name="sbarf">
            <DIV style="OVERFLOW: hidden; WIDTH: 68px; HEIGHT: 1px"></DIV><SPAN 
            style="FONT-WEIGHT: bold">药物组成</SPAN>
            <DIV>
            <TABLE class="sbasc sbwd"  cellSpacing="0" cellPadding="0">
              <TBODY>
              <TR>
                <TD>
                	<INPUT class="sbas" name="ywzcSubset" id="ywzcSubset" style="CURSOR: default" maxLength="100" value=""   onkeydown="subSearch();"/>
                </TD>
                <TD></TD></TR></TBODY></TABLE>
            <DIV class="csp cstf" id="sossbai地区" style="WIDTH: auto">
            </DIV></DIV></TD>
          <TD class="sbarf" id="sbarf房型" style="BORDER-RIGHT: #cccccc 1px solid" 
          name="sbarf">
            <DIV style="OVERFLOW: hidden; WIDTH: 68px; HEIGHT: 1px"></DIV><SPAN 
            style="FONT-WEIGHT: bold">功效</SPAN>
            <DIV>
            <TABLE class="sbasc sbwd"   cellSpacing="0" cellPadding="0"> 
              <TBODY>
               <TR>
                <TD>
                   <INPUT class="sbas" name="gxSubset" id="gxSubset" style="CURSOR: default"  maxLength="100" value=""  onkeydown="subSearch();"/></TD>
                <TD>
                </TD>
                </TR>
                </TBODY>
            </TABLE>
            </DIV></TD>
          <TD class="sbarf" style="BORDER-RIGHT: #cccccc 1px solid" name="sbarf">
            <SPAN  style="FONT-WEIGHT: bold">主治</SPAN>
            <DIV>
            <TABLE class="sbasc sbwd"    cellSpacing="0" cellPadding="0"> 
              <TBODY>
              <TR>
                  <TD>
                	 <INPUT class="sbas" id="zzSubset" name="zzSubset" style="CURSOR: default" maxLength="100" value=""  onkeydown="subSearch();"/>
                  </TD>
                  <TD></TD>
                  </TR>
                </TBODY>
              </TABLE>
         </TD> 
          </TR>
        </TBODY>
        <DIV class=tab>
	<form  id="form01" method="post" action="/pre/perInfo.do?perInfo=addSortlist&sortId=<%=request.getParameter("sortId") %>" >
			 <TBODY>  
			 
			  <%if(docList != null&&docList.size()>0){
			  
			     String rowcss = "";
			     String rowId = "";
        		 for(int i = 0;i<docList.size();i++){ 
                       PreEntry entry = (PreEntry)docList.get(i);
                       rowId = "result_" + entry.getPreId();
                       if(i%2 == 0)
                             rowcss = "cssf GrayRow";
                       else
                              rowcss = "cssf";
      			  %>
      			  
			    <TR align=rigth bgColor=<%if(i%2 == 0){out.println("#fffbff");}else{out.println("#eef1f9");} %>> 
				   <td width=5%><input type="checkbox" value="<%=entry.getId() %>" name="preId">&nbsp;&nbsp;<%=entry.getFangm() %></td> 
			       <td width=20%><%=Utilities.null2Blank(entry.getChufly()) %></td>
			       <td width=20%><%=Utilities.null2Blank(entry.getYaowzc()) %></td>
				   <td width=20%><%=Utilities.null2Blank(entry.getGongx()) %></td>
				   <td width=20%><%=Utilities.null2Blank(entry.getZhuz()) %></td>
			    </TR>  
			 </TBODY> 
			 <%}}else{%>
			  <TR class="cssf GrayRow" id="sprr" style="BORDER-RIGHT: #cccccc 1px solid; LINE-HEIGHT: 140%"> 
				 <td colspan="5">
				 没有符合查询条件的结果。
			      </td>
			        
			    </TR> 
			 <%} %>
 
<CENTER id=pp>
 <%  SearchPageUtil util = new SearchPageUtil(); 
      util.setUrl("/app/pre/simpleSearch.do");
      System.out.println("startNum:" +startNum);
       out.println(util.getPageStr(basePath,resultNum,"10",startNum,paramStr));
         %>
</CENTER>  
<SCRIPT>
//LIFESTYLE_hdf.paginationRange = 10;
//LIFESTYLE_hdf.resultSizePerPage = 20;
</SCRIPT>

<DIV class="csp" id="sprp"></DIV>
<DIV style="DISPLAY: none"><INPUT id="ErrorCode" type="hidden"/></DIV>
</body>
</html>  
